<template>
  <div class="divBox">
    <div class="box-card statistics">
        <div  class="panel-group">
    		<div class="card-panel">
    			<div class="card-panel-description">
    				<div class="card-panel-text">
    					<div class="card-order">早上好，{{agent.real_name}}</div>
    				</div>
    			</div>
    		</div>      
        </div>
    </div>
	
	
	<div style="background: #F0F2F5; padding: 20px">
		<div class="box-card statistics">
			<div  class="panel-group">
				<div class="card-panel">
					<div class="card-panel-description">
						<div class="card-panel-text">
							<div class="card-order">【账号余额: {{agent.now_money}}】</div>
						</div>
						<div class="card-panel-date">
							<span class="date_text">代理名称</span>
							<span class="date_num">{{adminInfo}}</span>              
						</div>
						<div class="card-panel-date">
							<span class="date_text">真实姓名</span>
							<span class="date_num">{{agent.real_name}}</span>              
						</div>
						<div class="card-panel-date">
							<span class="date_text">代理代码</span>
							<span class="date_num">{{agent.invitation_code}}</span>              
						</div>
						<div class="card-panel-date">
							<span class="date_text">推广链接</span>
							<span class="date_num">{{agent.invite_url}}</span>              
						</div>
					</div>
				</div>      
			</div>
		</div>
	</div>
	
  </div>
</template>

<script>
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import { agentDetailApi } from "@/api/home";
import { checkAuthApi, authTypeApi } from "@/api/maintain";
import { mapGetters } from "vuex";
import Cookies from "js-cookie";
export default {
  name: "Dashboard",
  data() {
    return {
      currentRole: "adminDashboard",
      adminInfo: Cookies.set('AdminName'),
	  agent:{}
    };
  },
  computed: {
    ...mapGetters(["roles"])
  },
  mounted() {
    console.log(!Cookies.get("auth"));
    this.getAuth();
    this.getAgent();
  },
  methods: {
    getAuth() {
      authTypeApi()
        .then(res => {
          const data = res.data || {};
          if(data.auth_code && data.auth) {
            this.authCode = data.auth_code;
            this.auth = true;
          }
        })
    },
    getAgent() {
      agentDetailApi()
        .then(res => {
			this.agent = res.data
        })
    },
  }
};
</script>

<style lang="scss" scoped>
.statistics {
    min-width: 700px;
}

.up,
.el-icon-caret-top {
    color: #F5222D;
    font-size: 12px;
    opacity: 1 !important;
}
.down,
.el-icon-caret-bottom {
    color: #39C15B;
    font-size: 12px;
    opacity: 1;
}
.header {
    &-title {
        font-size: 16px;
        color: #000000;
        font-weight: 500;
    }
    &-time {
        font-size: 12px;
        color: #8C8C8C;
    }
}
.card-panel {
    cursor: pointer;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    color: #8C8C8C;
    background: #fff;
    position: relative;
}
.card-panel-description {
    padding: 0 20px;
    margin-top: 19px;
    .card-panel-text {
        line-height: 18px;     
        margin-bottom: 12px;
        font-weight: normal;
        align-items: center;
        justify-content: space-between;
        display: flex;
        .card-order{
          color: #303133;
          font-size: 16px;
        }
        .card-date{
            border: 1px solid #6394F9;
            border-radius: 3px;
            color: #6394F9;
            background: #F4F7FF;
            text-align: center;
            line-height: 20px;
            width: 38px;
        }
    }
    .card-panel-num {
        font-size: 30px;
        color: #000;
        font-weight: bold;
    }
}
.card-panel-compared {
    margin: 15px 0;
}
.card-panel-date{
    border-top: 1px solid #EEEEEE;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 0;
  }
.content {
    &-is {
        opacity: 1%;
    }

    &-title {
        font-size: 14px;
        color: #000000;
        margin-bottom: 5px;
    }

    &-time {
        font-size: 12px;
        color: #8C8C8C;
        margin-bottom: 5px;
    }

    &-number {
        font-size: 30px;
    }
    .content-title{
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
}
.panel-group-count{
  margin-top: 18px;
  .card-panel-item{
    float: left;
  }
  .card-panel-count{
    background-color: #ffffff;
    border-radius: 4px;
    // width: 90%;
    height: 104px;
    text-align: center;
    padding-top: 20px;
    span{
      display: block;
    }
    .iconfont{
      font-size: 27px;
    }
    .panel-text{
      font-size: 14px;
      color: #303133;
      margin-top: 15px;
    }
  }
}
</style>
